Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Mocha is a feature-rich JavaScript test framework running on Node.js and in the browser, making asynchronous testing simple and fun. Mocha tests run serially, allowing for flexible and accurate reporting, while mapping uncaught exceptions to the correct test cases.
Test Organization
Organize tests in suites and sub-suites using describe() and context(), and specify test cases using it().
"use strict";\nconst assert = require('assert');\ndescribe('Array', function() {\n describe('#indexOf()', function() {\n it('should return -1 when the value is not present', function() {\n assert.equal([1, 2, 3].indexOf(4), -1);\n });\n });\n});
Asynchronous Testing
Support for testing asynchronous code with ease, using callbacks, promises, or async/await.
"use strict";\nconst assert = require('assert');\ndescribe('User', function() {\n describe('#save()', function() {\n it('should save without error', function(done) {\n const user = new User('Luna');\n user.save(function(err) {\n if (err) done(err);\n else done();\n });\n });\n });\n});
Hooks
Lifecycle hooks such as before(), after(), beforeEach(), and afterEach() for setting up preconditions and clean-up after tests.
"use strict";\ndescribe('Connection', function() {\n before(function() {\n // runs once before the first test in this block\n });\n\n after(function() {\n // runs once after the last test in this block\n });\n\n beforeEach(function() {\n // runs before each test in this block\n });\n\n afterEach(function() {\n // runs after each test in this block\n });\n\n // test cases\n});
Jest is a delightful JavaScript Testing Framework with a focus on simplicity. It works out of the box for any React project and is often compared to Mocha for its comprehensive feature set including a built-in assertion library and mock functions.
Jasmine is a behavior-driven development framework for testing JavaScript code. It does not rely on browsers, DOM, or any JavaScript framework. Thus, it's suited for websites, Node.js projects, or anywhere that JavaScript can run. It's compared to Mocha for its clean syntax and testing capabilities.
AVA is a test runner for Node.js with a concise API, detailed error output, and process isolation that lets you develop with confidence. It is often compared to Mocha for its modern, concurrent testing features, but differs in its approach to running tests in parallel by default.
Mocha is a simple, flexible, fun JavaScript test framework for node.js and the browser. For more information view the documentation.
project : mocha
repo age : 2 years, 11 months
active : 433 days
commits : 1424
files : 143
authors :
588 TJ Holowaychuk 41.3%
389 Tj Holowaychuk 27.3%
98 Travis Jeffery 6.9%
31 Guillermo Rauch 2.2%
13 Attila Domokos 0.9%
10 John Firebaugh 0.7%
8 Jo Liss 0.6%
7 Joshua Appelman 0.5%
7 Nathan Rajlich 0.5%
6 Brendan Nee 0.4%
6 James Carr 0.4%
6 Mike Pennisi 0.4%
5 Raynos 0.4%
5 Aaron Heckmann 0.4%
5 Ryunosuke SATO 0.4%
4 Forbes Lindesay 0.3%
4 Domenic Denicola 0.3%
4 Xavier Antoviaque 0.3%
4 hokaccha 0.3%
4 Jonathan Ong 0.3%
4 Joshua Krall 0.3%
3 Ben Lindsey 0.2%
3 Benjie Gillam 0.2%
3 Fredrik Enestad 0.2%
3 Sindre Sorhus 0.2%
3 Cory Thomas 0.2%
3 Mathieu Desvé 0.2%
3 Tyson Tate 0.2%
3 Valentin Agachi 0.2%
3 Wil Moore III 0.2%
3 Jesse Dailey 0.2%
3 Merrick Christensen 0.2%
3 eiji.ienaga 0.2%
3 fool2fish 0.2%
3 Nathan Bowser 0.2%
3 Paul Miller 0.2%
2 FARKAS Máté 0.1%
2 Shawn Krisman 0.1%
2 Jacob Wejendorp 0.1%
2 Jonas Westerlund 0.1%
2 Paul Armstrong 0.1%
2 Konstantin Käfer 0.1%
2 Michael Riley 0.1%
2 Michael Schoonmaker 0.1%
2 Andreas Lind Petersen 0.1%
2 domenic 0.1%
2 Quang Van 0.1%
2 fcrisci 0.1%
2 Nathan Alderson 0.1%
2 travis jeffery 0.1%
2 Juzer Ali 0.1%
2 Pete Hawkins 0.1%
2 Justin DuJardin 0.1%
2 David Henderson 0.1%
2 jsdevel 0.1%
2 Timo Tijhof 0.1%
2 Brian Beck 0.1%
2 Simon Gaeremynck 0.1%
2 Ian Storm Taylor 0.1%
2 Arian Stolwijk 0.1%
2 Alexander Early 0.1%
2 Ben Bradley 0.1%
2 Glen Mailer 0.1%
1 Maciej Małecki 0.1%
1 Mal Graty 0.1%
1 Marc Kuo 0.1%
1 Matija Marohnić 0.1%
1 Matt Robenolt 0.1%
1 Matt Smith 0.1%
1 Matthew Shanley 0.1%
1 Mattias Tidlund 0.1%
1 Michael Jackson 0.1%
1 Nathan Black 0.1%
1 Nick Fitzgerald 0.1%
1 Noshir Patel 0.1%
1 Panu Horsmalahti 0.1%
1 Phil Sung 0.1%
1 R56 0.1%
1 Refael Ackermann 0.1%
1 Richard Dingwall 0.1%
1 Romain Prieto 0.1%
1 Roman Neuhauser 0.1%
1 Roman Shtylman 0.1%
1 Russ Bradberry 0.1%
1 Russell Munson 0.1%
1 Rustem Mustafin 0.1%
1 Salehen Shovon Rahman 0.1%
1 Sasha Koss 0.1%
1 Seiya Konno 0.1%
1 Shaine Hatch 0.1%
1 Simon Goumaz 0.1%
1 Standa Opichal 0.1%
1 Stephen Mathieson 0.1%
1 Steve Mason 0.1%
1 Tapiwa Kelvin 0.1%
1 Teddy Zeenny 0.1%
1 Tim Ehat 0.1%
1 Vadim Nikitin 0.1%
1 Victor Costan 0.1%
1 Will Langstroth 0.1%
1 Yanis Wang 0.1%
1 Yuest Wang 0.1%
1 Zsolt Takács 0.1%
1 abrkn 0.1%
1 airportyh 0.1%
1 badunk 0.1%
1 claudyus 0.1%
1 fengmk2 0.1%
1 gaye 0.1%
1 grasGendarme 0.1%
1 lakmeer 0.1%
1 lodr 0.1%
1 qiuzuhui 0.1%
1 sebv 0.1%
1 tgautier@yahoo.com 0.1%
1 traleig1 0.1%
1 vlad 0.1%
1 yuitest 0.1%
1 Adam Crabtree 0.1%
1 Andreas Brekken 0.1%
1 Andrew Nesbitt 0.1%
1 Andrey Popp 0.1%
1 Arnaud Brousseau 0.1%
1 Atsuya Takagi 0.1%
1 Austin Birch 0.1%
1 Ben Noordhuis 0.1%
1 Bjørge Næss 0.1%
1 Brian Lalor 0.1%
1 Brian M. Carlson 0.1%
1 Brian Moore 0.1%
1 Bryan Donovan 0.1%
1 Casey Foster 0.1%
1 ChrisWren 0.1%
1 Christopher Hiller 0.1%
1 Corey Butler 0.1%
1 Daniel Stockman 0.1%
1 Dave McKenna 0.1%
1 Denis Bardadym 0.1%
1 Devin Weaver 0.1%
1 Di Wu 0.1%
1 Dmitry Shirokov 0.1%
1 Fedor Indutny 0.1%
1 Florian Margaine 0.1%
1 Frederico Silva 0.1%
1 Fredrik Lindin 0.1%
1 Gareth Aye 0.1%
1 Gareth Murphy 0.1%
1 Gavin Mogan 0.1%
1 Giovanni Bassi 0.1%
1 Glen Huang 0.1%
1 Greg Perkins 0.1%
1 Harish 0.1%
1 Harry Brundage 0.1%
1 Herman Junge 0.1%
1 Ian Young 0.1%
1 Ivan 0.1%
1 JP Bochi 0.1%
1 Jaakko Salonen 0.1%
1 Jakub Nešetřil 0.1%
1 James Bowes 0.1%
1 James Lal 0.1%
1 Jan Kopriva 0.1%
1 Jason Barry 0.1%
1 Javier Aranda 0.1%
1 Jean Ponchon 0.1%
1 Jeff Kunkle 0.1%
1 Jeremy Martin 0.1%
1 Jimmy Cuadra 0.1%
1 John Doty 0.1%
1 Jonathan Creamer 0.1%
1 Jonathan Park 0.1%
1 Jussi Virtanen 0.1%
1 Katie Gengler 0.1%
1 Kazuhito Hokamura 0.1%
1 Kirill Korolyov 0.1%
1 Koen Punt 0.1%
1 Laszlo Bacsi 0.1%
1 Liam Newman 0.1%
1 Linus Unnebäck 0.1%
1 László Bácsi 0.1%
FAQs
simple, flexible, fun test framework
The npm package mocha receives a total of 6,544,202 weekly downloads. As such, mocha popularity was classified as popular.
We found that mocha demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.